/**
 * Created by zhonglinfen on 2018/11/28.
 */
const mongoose = require('mongoose');
let ChatTheme = mongoose.model('ChatTheme');

class ChatThemeService{
    static async load(item){
        let result = await ChatTheme.find(item).exec();
        if(result){
            result = result[0];
        }
        return result;
    }

    static async save(item){
        let tempItem = new ChatTheme(item);
        return await tempItem.save();
    }

    static async searchChatTheme(chatID){
        let result = await ChatTheme.find({chatID:chatID});
        return result;
    }
}

module.exports = ChatThemeService;